package cn.edu.njpi.five;

public class MyThread extends Thread {
    private Bank bank;

    private int m;

    //存款
    public void deposit(Bank bank, int m) {
        this.bank = bank;
        this.m = m;
        this.start();
    }

    @Override
    public void run() {
        System.out.println("存款中，金额为:" + m);
        bank.deposit(m);
        System.out.println(bank.getName() + "  存款完毕，金额为:" + bank.getMoney());
    }
}
